package com.oplink.webems.modules.log.aop;

import org.aspectj.lang.Signature;

import com.alibaba.fastjson.JSONObject;
import com.oplink.webems.common.persistence.Page;

public class BaseLogAop {
	protected int getModule(Object o ){
		return AopModulesConstant.getModuleCode(o.getClass());
	}
	
	protected String getParams(Object[] args){
		StringBuffer sb = new StringBuffer();
		for(Object o : args){
			if(o == null){
				continue;
			}
			String param = "";
			if(o instanceof Page){
				param = "分页查询";
			}
			else{
				param = JSONObject.toJSONString(o);
				if(param.length() > 300){
					param = param .substring(0, 30)+"...";
				}
			}
			sb.append(param);
		}
		return sb.toString();
	}
	
	protected String getDesc(Signature s){
		
		return s.getName();
	}
}
